package a.a;

import a.c.d;
import a.c.e;
import a.c.k;
import a.c.n;
import a.c.q;
import a.c.*;
import a.i.a.c;
import a.i.db;
import a.i.h;

import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;

class ab
{
  private static ArrayList a(List paramList)
  {
    int i = m.b;
    boolean bool = m.a;
    ArrayList localArrayList = new ArrayList();
    do
    {
      ListIterator localListIterator = paramList.listIterator();
      while (locald == null)
      {
        if (!localListIterator.hasNext()) {
          break;
        }
        e locale = (e)localListIterator.next();
        locald = locale.h();
      }
      if ((i != 0) || (bool)) {
        break label95;
      }
      localArrayList.add(locald);
      d locald = locald.i();
    } while ((i == 0) && ((!bool) && (!bool)));
    label95:
    return localArrayList;
  }
  
  public static void a(q paramq, List paramList, n paramn)
  {
    a(paramq, paramList, a(paramList), paramn, false);
  }
  
  public static void a(q paramq, List paramList1, List paramList2, n paramn, boolean paramBoolean)
  {
    int k = m.b;
    boolean bool = m.a;
    if (k == 0) {
      if (paramq.m() == 0) {
        return;
      }
    }
    int i = paramq.j();
    x localx1 = db.a(new double[i]);
    x localx2 = db.a(new int[i]);
    x localx3 = db.a(new ArrayList[i]);
    n localn = db.b(new double[paramq.m()]);
    x localx4 = db.a(new double[i]);
    ListIterator localListIterator = paramList1.listIterator();
    label92:
    if (localListIterator.hasNext()) {}
    label177:
    label184:
    label314:
    label315:
    label586:
    label1104:
    do
    {
      e locale1 = (e)localListIterator.next();
      ArrayList localArrayList = new ArrayList();
      Object localObject1;
      e locale2;
      do
      {
        localObject1 = paramList2.listIterator();
        do
        {
          do
          {
            if (!((ListIterator)localObject1).hasNext()) {
              break;
            }
            localn.a(((ListIterator)localObject1).next(), 0.0D);
            if (k != 0) {
              break label184;
            }
            if (bool) {
              break label177;
            }
          } while (!bool);
        } while (k != 0);
        localObject1 = paramList1.listIterator();
        do
        {
          do
          {
            if (!((ListIterator)localObject1).hasNext()) {
              break label292;
            }
            locale2 = (e)((ListIterator)localObject1).next();
            localx3.a(locale2, new ArrayList());
            localx4.a(locale2, 0.0D);
            if (bool) {
              break;
            }
            if (locale2 == locale1) {
              break label267;
            }
            localx1.a(locale2, 0.0D);
            localx2.a(locale2, -1);
            if (k != 0) {
              break label289;
            }
          } while (!bool);
          localx1.a(locale2, 1.0D);
          localx2.a(locale2, 0);
        } while (!bool);
        localObject1 = new h(i);
      } while (k != 0);
      ((h)localObject1).a(locale1);
      do
      {
        Object localObject2;
        int j;
        do
        {
          if (!((h)localObject1).g()) {
            break label837;
          }
          while (k != 0)
          {
            e locale3;
            do
            {
              locale2 = (e)((h)localObject1).c();
              localArrayList.add(locale2);
              localObject2 = locale2.h();
              do
              {
                if (localObject2 == null) {
                  break;
                }
                locale3 = ((d)localObject2).f();
                if (bool) {
                  break label586;
                }
                if (localx2.getInt(locale3) < 0)
                {
                  ((h)localObject1).a(locale3);
                  localx2.a(locale3, localx2.getInt(locale2) + 1);
                }
                if (k == 0)
                {
                  if (localx2.getInt(locale3) == localx2.getInt(locale2) + 1)
                  {
                    if (k == 0)
                    {
                      if (localx1.getDouble(locale3) + localx1.getDouble(locale2) > 1.7976931348623157E+308D) {
                        throw new ArithmeticException("Number of Paths between " + locale1 + " and " + locale3 + " overflows double");
                      }
                      localx1.a(locale3, localx1.getDouble(locale3) + localx1.getDouble(locale2));
                    }
                    localObject3 = (ArrayList)localx3.get(locale3);
                    ((ArrayList)localObject3).add(localObject2);
                    localx3.a(locale3, localObject3);
                  }
                  localObject2 = ((d)localObject2).i();
                }
              } while (!bool);
              if ((k != 0) || (paramBoolean)) {
                break label315;
              }
              if ((k != 0) || (bool)) {
                break;
              }
              localObject2 = locale2.i();
              if (localObject2 == null) {
                break label315;
              }
              locale3 = ((d)localObject2).e();
            } while (bool);
            if (localx2.getInt(locale3) < 0)
            {
              ((h)localObject1).a(locale3);
              localx2.a(locale3, localx2.getInt(locale2) + 1);
            }
            if (k == 0)
            {
              if (localx2.getInt(locale3) == localx2.getInt(locale2) + 1)
              {
                if (k == 0)
                {
                  if (localx1.getDouble(locale3) + localx1.getDouble(locale2) > 1.7976931348623157E+308D) {
                    throw new ArithmeticException("Number of Paths between " + locale1 + " and " + locale3 + " overflows double");
                  }
                  localx1.a(locale3, localx1.getDouble(locale3) + localx1.getDouble(locale2));
                }
                localObject3 = (ArrayList)localx3.get(locale3);
                ((ArrayList)localObject3).add(localObject2);
                localx3.a(locale3, localObject3);
              }
              localObject2 = ((d)localObject2).j();
            }
            if (!bool) {
              break label314;
            }
            break label905;
          }
          if (localArrayList.isEmpty()) {
            break;
          }
          locale2 = (e)localArrayList.remove(localArrayList.size() - 1);
          localObject2 = (ArrayList)localx3.get(locale2);
          if (k != 0) {
            break label1104;
          }
          if ((k == 0) && (bool)) {
            return;
          }
          j = ((ArrayList)localObject2).size() - 1;
        } while (j < 0);
        Object localObject3 = (d)((ArrayList)localObject2).get(j);
        e locale4 = ((d)localObject3).a(locale2);
        localx4.a(locale4, localx4.getDouble(locale4) + localx1.getDouble(locale4) * (localx4.getDouble(locale2) + 1.0D) / localx1.getDouble(locale2));
        localn.a(localObject3, localx1.getDouble(locale4) * (localx4.getDouble(locale2) + 1.0D) / localx1.getDouble(locale2));
        paramn.a(localObject3, paramn.getDouble(localObject3) + localn.getDouble(localObject3));
        j--;
        if (k != 0) {
          break label92;
        }
        if ((k == 0) && (bool)) {
          break;
        }
        if ((k == 0) && (bool)) {
          return;
        }
      } while (!bool);
      paramq.a(localx1);
      paramq.a(localx3);
      paramq.a(localx2);
      paramq.a(localn);
    } while (k != 0);
    label267:
    label289:
    label292:
    label837:
    paramq.a(localx4);
    label905:
  }
  
  protected static void a(q paramq, List paramList1, List paramList2, n paramn, boolean paramBoolean, k paramk)
  {
    int m = m.b;
    boolean bool = m.a;
    if (m == 0) {
      if (paramq.m() == 0) {
        return;
      }
    }
    int i = paramq.k();
    double d1 = 0.01D;
    x localx1 = db.a(new double[i]);
    x localx2 = db.a(new double[i]);
    x localx3 = db.a(new ArrayList[i]);
    x localx4 = db.a(new double[i]);
    x localx5 = db.a(new double[i]);
    x localx6 = db.a(new boolean[i]);
    x localx7 = db.a(new double[i]);
    n localn = db.b(new double[paramq.m()]);
    c localc = new c(paramq);
    ListIterator localListIterator = paramList1.listIterator();
    label134:
    if (localListIterator.hasNext()) {}
    label219:
    label226:
    label375:
    label378:
    do
    {
      e locale = (e)localListIterator.next();
      ArrayList localArrayList1 = new ArrayList();
      Object localObject1 = paramList2.listIterator();
      do
      {
        do
        {
          if (!((ListIterator)localObject1).hasNext()) {
            break;
          }
          localn.a(((ListIterator)localObject1).next(), 0.0D);
          if (m != 0) {
            break label226;
          }
          if (bool) {
            break label219;
          }
        } while (!bool);
      } while (m != 0);
      localObject1 = paramList1.listIterator();
      Object localObject2;
      do
      {
        do
        {
          if (!((ListIterator)localObject1).hasNext()) {
            break label378;
          }
          localObject2 = (e)((ListIterator)localObject1).next();
          localx3.a(localObject2, new ArrayList());
          localx4.a(localObject2, 0.0D);
          localx7.a(localObject2, 0.0D);
          if (bool) {
            break label390;
          }
          if (localObject2 == locale) {
            break;
          }
          localx1.a(localObject2, 0.0D);
          localx6.a(localObject2, false);
          localx2.a(localObject2, 1.7976931348623157E+308D);
          localx5.a(localObject2, 1.7976931348623157E+308D);
          if (m != 0) {
            break label375;
          }
        } while (!bool);
        localx1.a(localObject2, 1.0D);
        localx2.a(localObject2, 0.0D);
        localx6.a(localObject2, true);
      } while (!bool);
      localc.d();
      if (m != 0) {
        break;
      }
      localObject1 = locale.h();
      ArrayList localArrayList2;
      do
      {
        if (localObject1 == null) {
          break;
        }
        localObject2 = ((d)localObject1).f();
        if (bool) {
          break label598;
        }
        if (paramk.getDouble(localObject1) == (1.0D / 0.0D)) {
          throw new ArithmeticException("Edge weight between " + locale + " and " + localObject2 + " overflows double");
        }
        localx5.a(localObject2, paramk.getDouble(localObject1));
        if (m == 0) {
          if (!localc.a((e)localObject2))
          {
            if (m != 0) {
              break label555;
            }
            localc.a((e)localObject2, localx5.getDouble(localObject2));
            if (!bool) {
              break label546;
            }
          }
        }
        localc.d((e)localObject2, localx5.getDouble(localObject2));
        localArrayList2 = (ArrayList)localx3.get(localObject2);
        localArrayList2.add(localObject1);
        localx3.a(localObject2, localArrayList2);
        localObject1 = ((d)localObject1).i();
      } while (!bool);
      if ((m == 0) && (!paramBoolean))
      {
        localObject1 = locale.i();
        do
        {
          if (localObject1 == null) {
            break;
          }
          localObject2 = ((d)localObject1).e();
          localx5.a(localObject2, paramk.getDouble(localObject1));
          if (bool) {
            break label752;
          }
          if (!localc.a((e)localObject2))
          {
            if (m != 0) {
              break label704;
            }
            localc.a((e)localObject2, localx5.getDouble(localObject2));
            if (!bool) {}
          }
          else
          {
            localc.d((e)localObject2, localx5.getDouble(localObject2));
          }
          localArrayList2 = (ArrayList)localx3.get(localObject2);
          localArrayList2.add(localObject1);
          localx3.a(localObject2, localArrayList2);
          localObject1 = ((d)localObject1).j();
        } while (!bool);
      }
      if (m == 0) {
        localArrayList1.add(locale);
      }
      do
      {
        int k;
        do
        {
          if (!localc.a()) {
            break label1611;
          }
          while (m != 0)
          {
            double d2;
            double d3;
            do
            {
              localObject1 = localc.b();
              localArrayList1.add(localObject1);
              localx2.a(localObject1, localx5.getDouble(localObject1));
              localx6.a(localObject1, true);
              localObject2 = (ArrayList)localx3.get(localObject1);
              int j = ((ArrayList)localObject2).size() - 1;
              do
              {
                do
                {
                  if (j < 0) {
                    break;
                  }
                  localx1.a(localObject1, localx1.getDouble(localObject1) + localx1.getDouble(((d)((ArrayList)localObject2).get(j)).a((e)localObject1)));
                  j--;
                  if ((m == 0) && (bool)) {
                    break label955;
                  }
                } while (!bool);
              } while (m != 0);
              if (localx1.getDouble(localObject1) == (1.0D / 0.0D)) {
                throw new ArithmeticException("Number of Paths between " + locale + " and " + localObject1 + " overflows double");
              }
              locald = ((e)localObject1).h();
              do
              {
                if (locald == null) {
                  break;
                }
                localObject3 = locald.f();
                if (bool) {
                  break label1280;
                }
                if (!localx6.getBool(localObject3))
                {
                  d2 = localx2.getDouble(localObject1) + paramk.getDouble(locald);
                  d3 = localx5.getDouble(localObject3);
                  if (m == 0) {
                    if (d2 == (1.0D / 0.0D)) {
                      throw new ArithmeticException("Distance between " + locale + " and " + localObject1 + " overflows double");
                    }
                  }
                  if (m == 0) {
                    if (Math.abs(d2 - d3) < d1)
                    {
                      localObject4 = (ArrayList)localx3.get(localObject3);
                      ((ArrayList)localObject4).add(locald);
                      localx3.a(localObject3, localObject4);
                      if (m != 0) {
                        continue;
                      }
                      if (!bool) {
                        break label1261;
                      }
                    }
                  }
                  if (m != 0) {
                    continue;
                  }
                  if (d2 < d3)
                  {
                    localx5.a(localObject3, d2);
                    if (m == 0) {
                      if (!localc.a((e)localObject3))
                      {
                        if (m != 0) {
                          break label1232;
                        }
                        localc.a((e)localObject3, localx5.getDouble(localObject3));
                        if (!bool) {
                          break label1223;
                        }
                      }
                    }
                    localc.d((e)localObject3, localx5.getDouble(localObject3));
                    localObject4 = (ArrayList)localx3.get(localObject3);
                    ((ArrayList)localObject4).clear();
                    ((ArrayList)localObject4).add(locald);
                    localx3.a(localObject3, localObject4);
                  }
                }
                locald = locald.i();
              } while (!bool);
              if ((m != 0) || (paramBoolean)) {
                break label753;
              }
              if ((m != 0) || (bool)) {
                break;
              }
              locald = ((e)localObject1).i();
              if (locald == null) {
                break label753;
              }
              localObject3 = locald.e();
            } while (bool);
            if (!localx6.getBool(localObject3))
            {
              d2 = localx2.getDouble(localObject1) + paramk.getDouble(locald);
              d3 = localx5.getDouble(localObject3);
              if (m == 0) {
                if (d2 == (1.0D / 0.0D)) {
                  throw new ArithmeticException("Distance between " + locale + " and " + localObject1 + " overflows double");
                }
              }
              if (m == 0) {
                if (Math.abs(d2 - d3) < d1)
                {
                  localObject4 = (ArrayList)localx3.get(localObject3);
                  ((ArrayList)localObject4).add(locald);
                  localx3.a(localObject3, localObject4);
                  if (m != 0) {
                    break label1608;
                  }
                  if (!bool) {
                    break label1599;
                  }
                }
              }
              if (m != 0) {
                break label1608;
              }
              if (d2 < d3)
              {
                localx5.a(localObject3, d2);
                if (m == 0) {
                  if (!localc.a((e)localObject3))
                  {
                    if (m != 0) {
                      break label1570;
                    }
                    localc.a((e)localObject3, localx5.getDouble(localObject3));
                    if (!bool) {
                      break label1561;
                    }
                  }
                }
                localc.d((e)localObject3, localx5.getDouble(localObject3));
                localObject4 = (ArrayList)localx3.get(localObject3);
                ((ArrayList)localObject4).clear();
                ((ArrayList)localObject4).add(locald);
                localx3.a(localObject3, localObject4);
              }
            }
            d locald = locald.j();
            if (!bool) {
              break label752;
            }
            break label1679;
          }
          if (localArrayList1.isEmpty()) {
            break;
          }
          localObject1 = (e)localArrayList1.remove(localArrayList1.size() - 1);
          localObject2 = (ArrayList)localx3.get(localObject1);
          if (m != 0) {
            break label1896;
          }
          if ((m == 0) && (bool)) {
            return;
          }
          k = ((ArrayList)localObject2).size() - 1;
        } while (k < 0);
        Object localObject3 = (d)((ArrayList)localObject2).get(k);
        Object localObject4 = ((d)localObject3).a((e)localObject1);
        localx7.a(localObject4, localx7.getDouble(localObject4) + localx1.getDouble(localObject4) * (localx7.getDouble(localObject1) + 1.0D) / localx1.getDouble(localObject1));
        localn.a(localObject3, localx1.getDouble(localObject4) * (localx7.getDouble(localObject1) + 1.0D) / localx1.getDouble(localObject1));
        paramn.a(localObject3, paramn.getDouble(localObject3) + localn.getDouble(localObject3));
        k--;
        if (m != 0) {
          break label134;
        }
        if ((m == 0) && (bool)) {
          break;
        }
        if ((m == 0) && (bool)) {
          return;
        }
      } while (!bool);
      paramq.a(localx1);
      paramq.a(localx4);
      paramq.a(localx3);
      paramq.a(localx5);
      paramq.a(localx2);
      paramq.a(localx6);
      paramq.a(localn);
    } while (m != 0);
    label390:
    label546:
    label555:
    label598:
    label752:
    label753:
    paramq.a(localx7);
    label704:
    label1223:
    label1232:
    label1261:
    return;
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.a.ab

 * JD-Core Version:    0.7.0.1

 */